<?php
// +----------------------------------------------------------------------
// | YFCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015-2016 http://www.rainfer.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: rainfer <81818832@qq.com>
// +----------------------------------------------------------------------
namespace Home\Controller;
use Think\Verify;
use Home\Controller\HomebaseController;
class IndexController extends HomebaseController {
	public function index(){
		$this->display(':index');
	}
	public function visit(){
		$id=I("get.id");
		$users_model=M("member_list");
		$user=$users_model->where(array("member_list_id"=>$id))->find();
		if(empty($user)){
			$this->error("查无此人！",0,0);
		}
		$this->assign($user);
		$this->display("User:index");
    }
	public function verify_msg()
    {
		ob_end_clean();
		$verify = new Verify (array(
            'fontSize' => 20,
            'imageH' => 40,
            'imageW' => 150,
            'length' => 4,
            'useCurve' => false,
        ));
        $verify->entry('msg');
    }
	//这里改成提交订单的
	public function addmsg(){
		if (IS_POST){
			$map ['forms_id'] =  $_POST['forms_id'];
			$fields = M ( 'forms_attribute' ) -> where ( $map )->order ( 'sort asc, id asc' )->select ();
			foreach ( $fields as $vo ) {	
				$post [$vo ['title']] = $_POST [$vo ['name']];
				unset ( $_POST [$vo ['name']] );
			}
			$data=array(
				'forms_id' => $_POST['forms_id'],
				'value' => serialize ( $post ),
				'cTime'=> time(),
				'realName' => trim($_POST ['realName']),
				'mobile' => trim($_POST ['mobile']),
				'address' => trim($_POST ['address']),
				'remark' => trim($_POST ['remark']),
				'sug_ip'=> get_client_ip(0,true)
			);
			$rst=M('forms_value')->data($data)->add();
			$data = array();
			if($rst!==false){
				$data['text'] = "订单提交成功，请保持电话通畅" ;	
			}else{
				$data['text'] = "提交失败" ;	
			}
			$this->ajaxReturn($data);
		}	
			
	}
}